<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>自己循环</title>
		<script src="../js/jquery-3.4.1.min.js"></script>
		<script>
		$(function(){
			//$("#d1 p").text("this is a p");
			// $("#d1 p").each(function(o,i){
			// 	//o是对象，是dom元素，i是下标
			// 	$(o).html("第"+(i+1)+"个元素");
			// });
			$.each($("#d1 p"),function(i,o){
				//o是对象，是dom元素，i是下标
				//console.log(o+",,,"+i);
				$(o).html("第"+(i+1)+"个元素");
				if(i>5)
					return false;
			});
		});
		</script>
	</head>
	<body>
		<div id="d1">
			<p>65333</p>
			<p>7</p>
			<p>7</p>
			<p>6</p>
			<p>6</p>
			<p>5</p>
			<p>4</p>
			<p>3</p>
			<p>2</p>
			<p>1</p>
		</div>
	</body>
</html>
